[mirrors]
http://xmlsoft.org/sources/libxml2-2.9.3.tar.gz
ftp://xmlsoft.org/libxml2/libxml2-2.9.3.tar.gz
ftp://gd.tuwien.ac.at/pub/libxml/libxml2-2.9.3.tar.gz

[vars]
filesize=5477112
sha512=078afa65229de4f23e6538767253fb4f9f61d96cb72e445179c71d536b224d54922f22972a2b71434796f83f8c99f6a46c3b8813cb4582ad9fca696d141e0abb
desc="bloated and buggy XML parsing library with a history of security vulns"

[deps]
zlib
xz

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) --with-sysroot=$butch_root_dir"
CFLAGS="-D_GNU_SOURCE -fPIC $optcflags" \
LDFLAGS="$optldflags" \
./configure -C \
  --prefix="$butch_prefix" --enable-shared --without-iconv \
  --without-iso8859x --without-legacy --without-python \
  --disable-silent-rules $xconfflags

patch_status() {
	kv=$(printf 'S["%s"]="%s"\n' "$1" "$2")
	sed -i 's,^S.*'$1'.*=.*$,'"$kv"',' config.status
}

if [ -n "$CROSS_COMPILE" ] ; then
patch_status PYTHON_SITE_PACKAGES "$butch_root_dir""$butch_prefix"/lib/python2.7/site-packages
patch_status PYTHON_INCLUDES "$butch_root_dir""$butch_prefix"/include/python2.7
patch_status PYTHON_VERSION 2.7
patch_status PYTHON_LIBS "-L$butch_root_dir$butch_prefix/lib/python2.7/config -lpython2.7 -Xlinker -export-dynamic"
sh config.status
fi

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

sed -i 's@-lxml2@-lxml2 -lz -llzma@' "$butch_install_dir""$butch_prefix"/lib/pkgconfig/libxml-2.0.pc
